package main

func modifiedMatrix(matrix [][]int) [][]int {
	m := len(matrix)
	n := len(matrix[0])
	maxList := make([]int, n)
	for j := 0; j < n; j++ {
		max := -100
		for i := 0; i < m; i++ {
			if matrix[i][j] > max {
				max = matrix[i][j]
			}
		}
		maxList[j] = max
	}
	for j := 0; j < n; j++ {
		for i := 0; i < m; i++ {
			if matrix[i][j] == -1{
				matrix[i][j] = maxList[j]
			}
		}
	}
	return matrix
}